<template>
	<view class="content">
		<view v-for="(item,index) in courseInfo" :key="index">
		<view class="titleStyle">
			{{item.courseTitle}}
		</view>
		<view class="schoolStyle">
		{{item.ownSchool}}
		<text class="textStyle">{{item.teacherName}}</text>
		<text class="numStyle">{{item.takeInNum}}<text class="inStyle">人参加</text></text>
		</view>
		<view>
			<view class="subTitle">课程介绍</view>
			<view class="introduceStyle">{{item.courseIntroduce}}</view>
		</view>
		</view>
		<view style="height: 110rpx;"></view>
	</view>
</template>

<script>
	import {
		getCourseIntroduce
	} from "@/api/modules/joinCourse.js"
	export default {
		data() {
			return {
				joinCourse: {
					courseTitle: 'Python数据分析与展示',
					ownSchool: '北京理工大学',
					ownTeacher: '崇天',
					takeInNum: 100000,
					courseIntroduce: '“我们正步入一个数据或许比软件更重要的新时代。——Tim O\'Reilly” 运用数据是精准刻画事物、呈现发展规律的主要手段，分析数据展示规律，把思想变得更精细！ ——\“弹指之间·享受创新\”，通过8周学习，你将掌握利用Python语言表示、清洗、统计和展示数据的能力。',
				},
				courseInfo:[],
				formdata:{
					courseId:1
				}
			}
		},
		props: {
			courseID: {
				type: String,
				default: 'add'
			}
		},
		watch: {
			courseID: {
				immediate: true, // 这句重要
				handler(val) {
					// 继续要处理的事件
					// console.log("获取课程章节")
					//console.log("进入的介绍页"+val)
		
					// 获取课程ID对应的章节列表
					let data = {
						courseId: val
					}
		
					let that = this;
					
					that.courseInfoID = val;
		
					getCourseIntroduce(data)
						.then(resp => {
							this.courseInfo = resp.data.introducelist
								//console.log("有东西吗"+this.studylist[0].courseID)
								uni.setStorageSync('courseInfo',this.courseInfo)
							}).catch({})
				}
			}
		
		},
		/* mounted() {
			let that = this;
			let data = {
				courseId: that.courseID
			}
			getCourseIntroduce(data)
				.then(resp => {
					this.courseInfo = resp.data.introducelist
					//console.log("有东西吗"+this.studylist[0].courseID)
					uni.setStorageSync('courseInfo',this.courseInfo)
				}).catch({})
		} */
	}
</script>

<style>
	.content {
		width: 750rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
	}

	.titleStyle {
		margin-top: 30rpx;
		font-size: 50rpx;
		font-weight: bold;
	}
	.schoolStyle {
		margin-top: 80rpx;
		color: #383838;
	}
	.textStyle{
		margin-left: 30rpx;
		color: #383838;
	}
	.numStyle{
		float: right;
		margin-right: 30rpx;
		color: #29FF5E;
	}
	.inStyle{
		color: #383838;
	}
	.subTitle{
		margin-top: 100rpx;
		font-size: 40rpx;
		font-weight: bold;
	}
	.introduceStyle{
		margin-top: 30rpx;
		font-size: 30rpx;
		color: #ff8d1a;
		font-weight: 700;
	}
</style>
